-
Notifications
You must be signed in to change notification settings - Fork 299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove equivocating indices from score consideration #5397
Conversation
ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/forkchoice/VoteTracker.java
Outdated
Show resolved
Hide resolved
...m/statetransition/src/main/java/tech/pegasys/teku/statetransition/forkchoice/ForkChoice.java
Outdated
Show resolved
Hide resolved
storage/src/main/java/tech/pegasys/teku/storage/store/Store.java
Outdated
Show resolved
Hide resolved
storage/src/main/java/tech/pegasys/teku/storage/store/StoreTransaction.java
Outdated
Show resolved
Hide resolved
.../beaconchain/src/main/java/tech/pegasys/teku/services/beaconchain/BeaconChainController.java
Show resolved
Hide resolved
…uivocating-indices
TODO:
|
Test finished, ready for review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In terms of storing a version with vote tracker information, I wouldn't bother. It's quite easy to handle adding additional fields which is all we need here and we're unlikely to need to remove any of the existing fields. If we do in the future we can either add versioning or just discard existing tracked votes - as a one of thing for a migration there won't be any issue with that, we'll just be less able to determine the current head after restart until we start receiving attestations again, so it resolves itself within an epoch and may not make any difference if we need to sync for more than a couple of blocks.
ethereum/core/src/testFixtures/java/tech/pegasys/teku/core/AttesterSlashingGenerator.java
Outdated
Show resolved
Hide resolved
ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/forkchoice/VoteTracker.java
Outdated
Show resolved
Hide resolved
ethereum/spec/src/main/java/tech/pegasys/teku/spec/datastructures/forkchoice/VoteTracker.java
Outdated
Show resolved
Hide resolved
} | ||
|
||
public Bytes32 getNextRoot() { | ||
return nextRoot; | ||
static VoteTracker markCurrentEquivocating(final VoteTracker voteTracker) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this method should exist as when we apply a vote we need to ensure we update all fields, not just equivocating.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We shouldn't update latest_messages
vote for equivocating validator as by the spec, and dedicated method ensures that vote fields are not changed
https://github.com/ethereum/consensus-specs/blame/dev/specs/phase0/fork-choice.md#L365
Or perhaps, I don't understand what do you mean
...m/statetransition/src/main/java/tech/pegasys/teku/statetransition/forkchoice/ForkChoice.java
Outdated
Show resolved
Hide resolved
...m/statetransition/src/main/java/tech/pegasys/teku/statetransition/forkchoice/ForkChoice.java
Outdated
Show resolved
Hide resolved
storage/src/main/java/tech/pegasys/teku/storage/protoarray/ForkChoiceStrategy.java
Outdated
Show resolved
Hide resolved
if (vote.isNextEquivocating()) { | ||
newVote = VoteTracker.markCurrentEquivocating(vote); | ||
} else { | ||
newVote = VoteTracker.create(vote.getNextRoot(), vote.getNextRoot(), vote.getNextEpoch()); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd just simplify this to:
if (vote.isNextEquivocating()) { | |
newVote = VoteTracker.markCurrentEquivocating(vote); | |
} else { | |
newVote = VoteTracker.create(vote.getNextRoot(), vote.getNextRoot(), vote.getNextEpoch()); | |
} | |
newVote = new VoteTracker(vote.getNextRoot(), vote.getNextRoot(), vote.getNextEpoch(), vote.isNextEquivocating(), vote.isNextEquivocating()); |
it probably doesn't matter if we don't actually update the current roots once the validator is equivocating but since it's simple, it makes sense to get our records straight and show that we have considered that next vote now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Returning to this one. I've applied your suggestion but according to the spec, we shouldn't update votes for equivocated validators. This shouldn't hurt anything from the first look, but it could be our bug in the future
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've reverted this one too, but if you think it's safe to update it, I will put it back
.../main/java/tech/pegasys/teku/storage/server/kvstore/serialization/VoteTrackerSerializer.java
Outdated
Show resolved
Hide resolved
.../main/java/tech/pegasys/teku/storage/server/kvstore/serialization/VoteTrackerSerializer.java
Outdated
Show resolved
Hide resolved
Co-authored-by: Adrian Sutton <adrian@symphonious.net>
Co-authored-by: Adrian Sutton <adrian@symphonious.net>
…ng indices are on or off Co-authored-by: Adrian Sutton <adrian@symphonious.net>
@ajsutton
|
I'll have to look at the spec in more detail but our implementation of fork choice is very different from the spec version. It's probably not a big deal which way it goes to be honest. I don't think the database needs all of TekuConfiguration passed through but it already has a number of config items that affect how it behaves. The current version means everything that deals with this is handling multiple versions but we want to isolate the feature toggling to just the key entry points (eg the database) |
Generally I agree that from some angle equivocating indices feature toggle looks like a part of spec (it's a part of spec btw :) |
So I think you're misunderstanding what the spec is saying vs what our code is doing because while our code gives the same results as the spec the implementation is very very different. The high level overview of it is that the spec applies attestations in a single step - by adding them to So for us, not applying an attestation from an equivocating validator means not updating the The idea of next and current doesn't exist in the spec so it's just for our record keeping and it's more accurate to say that we have applied the latest changes for that validator (so current and next have the same values). |
Thank you for explanation. I finally got it. The same way we set intention to change vote's target epoch, and incarnate it later in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, just need to move the config out of SpecConfig to StorageConfiguration (it will likely mean passing it through as a boolean in a few layers but that will only be temporary until we remove the feature toggle again).
@@ -135,6 +135,8 @@ static SpecConfigBuilder builder() { | |||
|
|||
int getProposerScoreBoost(); | |||
|
|||
boolean isEquivocatingIndicesEnabled(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hmm, I don't think this belongs in SpecConfig
as it's not coming from the config the spec provides. For the storage side it should just wind up in StorageConfiguration
.
@ajsutton did you mean something like this? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep spot on. Thanks.
PR Description
Activates ethereum/consensus-specs#2845
Currently in progress, posting draft.
My current TODO:
FFGUpdatesTest
VotesTest
ForkChoiceTest
Fixed Issue(s)
Fixes #5133
Documentation
doc-change-required
label to this PR if updates are required.Changelog